home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
751-760
/
758
/
nochange
/
nochange.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
7KB
|
326 lines
/* NoChange.c Written by Kamran Karimi on an A500 running OS1.3
compiled with Aztec C 3.6 */
#include <exec/types.h>
#include <intuition/intuition.h>
struct TextAttr BoldMess =
{ (STRPTR)"topaz.font",TOPAZ_SIXTY,FSF_BOLD|FSF_ITALIC,FPF_ROMFONT };
struct TextAttr Message =
{ (STRPTR)"topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT };
SHORT GadPairs[] =
{ 7,11,7,3,135,3 };
struct Border GadBord =
{ 2,1,1,0,JAM1,3,GadPairs,NULL };
struct IntuiText EndText =
{ 1,2,JAM2,10,5,&Message,(UBYTE *)" Quit Program ",NULL };
struct Gadget EndGad =
{ NULL,223,35,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
(APTR)&GadBord,NULL,&EndText,NULL,NULL,3,NULL };
struct IntuiText AcceptText =
{ 1,2,JAM2,10,5,&Message,(UBYTE *)" Accept Changes ",NULL };
struct Gadget AcceptGad =
{ &EndGad,393,52,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
(APTR)&GadBord,NULL,&AcceptText,NULL,NULL,2,NULL };
struct IntuiText RestoreText =
{ 1,2,JAM2,10,5,&Message,(UBYTE *)" Restore Vectors",NULL };
struct Gadget RestoreGad =
{ &AcceptGad,33,52,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
(APTR)&GadBord,NULL,&RestoreText,NULL,NULL,1,NULL };
struct IntuiText DoNothingText =
{ 1,2,JAM2,10,5,&Message,(UBYTE *)" Do Nothing ",NULL };
struct Gadget DoNothingGad =
{ &RestoreGad,223,52,140,10,GADGHCOMP,GADGIMMEDIATE,BOOLGADGET,
(APTR)&GadBord,NULL,&DoNothingText,NULL,NULL,4,NULL };
struct IntuiText Text1 =
{ 3,0,JAM2,250,2,&BoldMess,(UBYTE *)"DANGER!",NULL };
struct IntuiText Text2 =
{ 1,0,JAM2,277,12,&BoldMess,(UBYTE *)" Have Been Changed!",&Text1 };
struct IntuiText DBAlert =
{ 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"DebugEntry/Data Vectors ",NULL };
struct IntuiText KMx =
{ 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"KickMem/TagPtr Vectors ",NULL };
struct IntuiText DS =
{ 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"DoIO/SendIO Vectors ",NULL };
struct IntuiText CCC =
{ 3,0,JAM2,33,12,&BoldMess,(UBYTE *)"Cold/CoolCapture Vectors ",NULL };
struct IntuiText Intro1 =
{ 2,0,JAM2,240,3,&BoldMess,(UBYTE *)"NO CHANGE",NULL };
struct IntuiText Intro2 =
{ 1,0,JAM2,55,15,&Message,(UBYTE *)
" Informs you of changes made to some ExecBase vectors",&Intro1 };
struct IntuiText Intro3 =
{ 3,0,JAM2,220,30,&Message,(UBYTE *)" By Kamran Karimi",&Intro2 };
struct NewWindow MyWindow =
{ 30,20,575,50,2,3,NULL,WINDOWDEPTH|WINDOWDRAG,NULL,
NULL,(UBYTE *)"NO CHANGE",NULL,NULL,0,0,0,0,WBENCHSCREEN };
struct IntuitionBase *IntuitionBase;
struct Window *window;
struct IntuiMessage *Intuimessage;
USHORT GadNR;
struct RastPort *windowRP;
ULONG ColdC,CoolC,DoIO1,SendIO1,ColdC2,CoolC2,DoIO2,SendIO2;
ULONG DBData,DBData2,DBEntry,DBEntry2,AlertData,AlertData2;
ULONG KMPtr,KMPtr2,KTPtr,KTPtr2,KCPtr,KCPtr2;
struct IntuiText *Warn;
UWORD CheckSum,CheckSum2;
struct Library *OpenLibrary();
struct Window *OpenWindow();
void CloseWindow(),CloseLibrary();
void PrintIText(),Forbid(),Permit(),Delay();
main()
{
void Changed(),Accept(),Close_All(),Restore();
ULONG Result;
if (!(IntuitionBase = (struct IntuitionBase *)
OpenLibrary("intuition.library",0L)))
{
Close_All();
exit(0);
}
if (!(window = OpenWindow(&MyWindow)))
{
Close_All();
exit(10);
}
windowRP = window->RPort;
PrintIText(windowRP,&Intro3,0L,10L);
Delay(120L);
CloseWindow(window);
MyWindow.FirstGadget = &DoNothingGad;
MyWindow.IDCMPFlags = GADGETDOWN;
MyWindow.Height = 80;
Forbid();
#asm
move.l a6,-(a7)
move.l 4,a6
move.l 42(a6),_ColdC
move.l 46(a6),_CoolC
move.l 66(a6),_DBEntry
move.l 70(a6),_DBData
move.l 74(a6),_AlertData
move.w 82(a6),_CheckSum
move.l 546(a6),_KMPtr
move.l 550(a6),_KTPtr
move.l 554(a6),_KCPtr
move.l -454(a6),_DoIO1
move.l -460(a6),_SendIO1
move.l (a7)+,a6
#endasm
Permit();
while(TRUE)
{
Delay(1500L);
Forbid();
#asm
move.l a6,-(a7)
move.l 4,a6
move.l 42(a6),_ColdC2
move.l 46(a6),_CoolC2
move.l 66(a6),_DBEntry2
move.l 70(a6),_DBData2
move.l 74(a6),_AlertData2
move.w 82(a6),_CheckSum2
move.l 546(a6),_KMPtr2
move.l 550(a6),_KTPtr2
move.l 554(a6),_KCPtr2
move.l -454(a6),_DoIO2
move.l -460(a6),_SendIO2
move.l (a7)+,a6
#endasm
Permit();
Warn = &CCC;
if((CheckSum - CheckSum2)||(ColdC - ColdC2)||(CoolC - CoolC2))
Changed(1);
Warn = &DBAlert;
if((DBEntry - DBEntry2)||(DBData - DBData2)||(AlertData - AlertData2))
Changed(2);
Warn = &KMx;
if((KMPtr - KMPtr2)||(KTPtr - KTPtr2)||(KCPtr - KCPtr2))
Changed(3);
Warn = &DS;
if((DoIO1 - DoIO2)||(SendIO1 - SendIO2))
Changed(4);
}
}
void Changed(i)
short i;
{
short j;
if(!(window = OpenWindow(&MyWindow)))
{
Close_All();
exit(10);
}
j = i;
windowRP = window->RPort;
PrintIText(windowRP,&Text2,0L,10L);
PrintIText(windowRP,Warn,2L,10L);
#asm
movem.l d0/d1/a0/a1/a6,-(a7)
move.l 4,a6
move.l _window,a0
move.l 86(a0),a0
jsr -384(a6)
move.l _window,a0
move.l 86(a0),a0
jsr -372(a6)
move.l d0,_Intuimessage
move.l d0,a0
move.l $1c(a0),a0
move.w $26(a0),_GadNR
move.l _Intuimessage,a1
jsr -378(a6)
movem.l (a7)+,d0/d1/a0/a1/a6
#endasm
switch(GadNR)
{
case 1:
Restore(j);
break;
case 2:
Accept(j);
break;
case 3:
Close_All();
exit(0);
case 4:
break;
}
CloseWindow(window);
return;
}
void Accept(i)
short i;
{
switch(i)
{
case 1:
CheckSum = CheckSum2;
ColdC = ColdC2;
CoolC = CoolC2;
break;
case 2:
DBEntry = DBEntry2;
DBData = DBData2;
AlertData = AlertData2;
break;
case 3:
KMPtr = KMPtr2;
KTPtr = KTPtr2;
KCPtr = KCPtr2;
break;
case 4:
DoIO1 = DoIO2;
SendIO1 = SendIO2;
break;
}
return;
}
void Restore(i)
short i;
{
switch(i)
{
case 1:
Forbid();
#asm
move.l a6,-(a7)
move.l 4,a6
move.w _CheckSum,82(a6)
move.l _ColdC,42(a6)
move.l _CoolC,46(a6)
move.l (a7)+,a6
#endasm
Permit();
break;
case 2:
Forbid();
#asm
move.l a6,-(a7)
move.l 4,a6
move.l _DBEntry,66(a6)
move.l _DBData,70(a6)
move.l _AlertData,74(a6)
move.l (a7)+,a6
#endasm
Permit();
break;
case 3:
Forbid();
#asm
move.l a6,-(a7)
move.l 4,a6
move.l _KMPtr,546(a6)
move.l _KTPtr,550(a6)
move.l _KCPtr,554(a6)
move.l (a7)+,a6
#endasm
Permit();
break;
case 4:
Forbid();
#asm
move.l a6,-(a7)
move.l 4,a6
move.l _DoIO1,-454(a6)
move.l _SendIO1,-460(a6)
move.l (a7)+,a6
#endasm
Permit();
break;
}
return;
}
void Close_All()
{
if(window) CloseWindow(window);
if(IntuitionBase) CloseLibrary(IntuitionBase);
return;
}